package es.udc.emarketapp.emarket.model.countryFacade.actions;

import java.sql.Connection;

import es.udc.emarketapp.emarket.model.country.dao.SQLCountryDAO;
import es.udc.emarketapp.emarket.model.country.dao.SQLCountryDAOFactory;

import es.udc.fbellas.j2ee.util.exceptions.InstanceNotFoundException;
import es.udc.fbellas.j2ee.util.exceptions.InternalErrorException;
import es.udc.fbellas.j2ee.util.sql.NonTransactionalPlainAction;

public class FindAvaliableCountriesToSpecifyShippingAction implements NonTransactionalPlainAction {

    private String idSeller;
    private String language;

    public FindAvaliableCountriesToSpecifyShippingAction(String idSeller,
            String language) {
        this.idSeller = idSeller;
        this.language = language;
    }

    public Object execute(Connection connection)
            throws InstanceNotFoundException, InternalErrorException {

        SQLCountryDAO countryDAO = SQLCountryDAOFactory.getDAO();

        if (!language.equals("es")) {
            language = "en";
        }
        return countryDAO.findAvaliableCountriesToSpecifyShipping(connection,
                idSeller, language, 1, 239);

    }
}
